package com.example.demo.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.demo.entity.Admin;
import com.example.demo.mapper.AdminMapper;
import com.example.demo.service.AdminService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author shenrui
 * @date 2021/9/19
 * @description 实现AdminService,继承ServiceImpl里面的增删改查方法
 */

@Slf4j
@Service
public class AdminServiceImpl extends ServiceImpl<AdminMapper, Admin> implements AdminService {
    /**
     * 根据继承的getOne方法，查找是否有符合的admin
     */

    @Override
    public Admin verifyAdminLogin(Admin admin) {


        return this.getOne(new LambdaQueryWrapper<Admin>().eq(Admin::getAdAccount,admin.getAdAccount())
                                                          .eq(Admin::getAdPassword,admin.getAdPassword()));

    }
}
